[#160] Fix getRoyaltyInfo ABI mismatch#161
Conversation
…iciary) The deployed MCV2_Bond contract's getRoyaltyInfo takes two address params (token + beneficiary) and returns a single uint256, not one address param returning (uint256, address). Updated ABI in lib/price.ts, SDK, and CLI. Components now fetch the bond creator via tokenBond() and pass it as the beneficiary argument. Fixes #160 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
T2b APPROVE
Reviewed all 8 files. The ABI correction is consistent across all layers:
-
ABI definitions (lib/price.ts, sdk/abi.ts) — Both updated to
(address token, address beneficiary) → uint256. Consistent. -
SDK client (client.ts) —
getRoyaltyInfonow takesbeneficiaryparam, returns{ unclaimed }.RoyaltyInfointerface updated. Clean breaking change. -
CLI (claim.ts, status.ts) — Both fetch
tokenBond()first to get creator, then pass as beneficiary. Good restructuring in claim.ts to avoid duplicatetokenBondcalls. -
Web components:
WriterTradingStats— Correctly splits into two dependent queries withenabledguard.ClaimRoyalties— Acceptsbeneficiaryprop, includes it in query key for proper cache invalidation.writer/page.tsx— ThreadswriterAddressdown asbeneficiary. Safe since the dashboard only shows the connected wallet's storylines.
No issues found.
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
The PR corrects the deployed getRoyaltyInfo(token, beneficiary) ABI across the app, SDK, and CLI, and updates the affected royalty reads to supply the beneficiary address. I did not find any remaining one-argument callers, and CI is passing.
Findings
- [info] No remaining blocking findings.
- File:
packages/sdk/src/client.ts:500 - Suggestion: None.
- File:
Decision
Approving because the ABI mismatch is fixed consistently across the relevant surfaces, the writer dashboard royalty reads are restored, and the required lint-and-typecheck check is green.
Summary
getRoyaltyInfoon the deployed MCV2_Bond takes(address token, address beneficiary)→uint256, not(address token)→(uint256, address)as previously assumedlib/price.ts,packages/sdk/src/abi.ts, andpackages/sdk/src/client.tsWriterTradingStatsandClaimRoyaltiesnow fetch the bond creator viatokenBond()and pass it as the beneficiaryclaimandstatuscommands updated to use the correct 2-arg signatureFixes #160
Test plan
tsc --noEmit— zero errorsnext build— cleanvitest run— 22/22 tests passgetRoyaltyInfo(token, creator)returns unclaimed amount🤖 Generated with Claude Code